package com.white.ndkmaster;

/**
 * Created by yutf on 2017/9/30 0030.
 */

public class NativeX
{
    static
    {
        System.loadLibrary("white");
        System.loadLibrary("bobo");
    }

    /***
     * 微博key
     */
    public static final int WBK = 1;
    /***
     * 微博secret
     */
    public static final int WBS = 2;
    /***
     * 微信key
     */
    public static final int WXK = 3;
    /***
     * 微信secret
     */
    public static final int WXS = 4;
    /***
     * qq key
     */
    public static final int QQK = 5;
    /***
     * qq secret
     */
    public static final int QQS = 6;
    /***
     * 接口地址
     */
    public static final int WEB_BASE = 7;
    /***
     * 百度key
     */
    public static final int BDK = 8;
    /***
     * 百度secret
     */
    public static final int BDS = 9;

    /***
     * 接口token
     */
    public static final int TOKEN = 10;

    /***
     * aes pwd
     */
    public static final int AESPWD = 11;

    /***
     * aes pwd
     */
    public static final int WXPATNERID = 12;

    /***
     * 获取MD5
     * @param ctx   context对象，传入context可以验证调用是否合法(如果其他项目的签名不同则调用会失败)
     * @param s
     * @return
     */
    public native static String md5(Object ctx, String s);

    /***
     * MD5
     * @param s 待加密的串
     * @return
     */
    public native static String md5(String s);

    /***
     * sha1加密
     * @param s 待加密的串
     * @return
     */
    public native static String sha1(String s);

    /***
     * aes加密
     * @param ctx   context对象，传入context可以验证调用是否合法(如果其他项目的签名不同则调用会失败)，key已经内置
     * @param src   待加密串
     * @return
     */
    public native static String aesEcbEncrypt(Object ctx, String src);

    /***
     * aes加密
     * @param key   密匙
     * @param src   待加密串
     * @return
     */
    public native static String aesEcbEncryptWithKey(String key, String src);

    /***
     * aes解密
     * @param ctx   context对象，传入context可以验证调用是否合法(如果其他项目的签名不同则调用会失败)，key已经内置
     * @param src   待解密串
     * @return
     */
    public native static String aesEcbDecrypt(Object ctx, String src);
    public native static String aesEcbDecryptWithKey(String key, String src);


    public native static String aesCbcEncrypt(String iv, String key, String src);
    public native static String aesCbcDecrypt(String iv, String key, String src);

    public native static String get(Object ctx, int type);

    /****
     * 获取app签名，是一个很长的字符串
     * @param context
     * @return
     */
    public native static String getSingleSign(Object context);

    /****
     * 获取app签名，是一个很长的字符串
     * @param context
     * @return
     */
    public native static String getSign(Object context);

    /***
     * 建字符串写入文件
     * @param path      绝对路径
     * @param content   待写入的内容
     * @return
     */
    public native static int writeString(String path, String content);

    /***
     * 建字符串写入文件
     * @param path      绝对路径
     * @return
     */
    public native static String readString(String path);
}
